{% extends "base.html" %} {% block title %}Accounts - Quick Care Connect{% endblock %} {% block content %}
Admin Panel

{{ get_current_user().name }}

Management
{% include 'admin/_management_sidebar.html' %}

Accounts Dashboard

Platform Revenue
PKR {{ "%.0f"|format(total_platform_revenue) }}
Reserve (held)
PKR {{ "%.0f"|format(reserve_total) }}
{{ reserve_count }} appointment{% if reserve_count != 1 %}s{% endif %} held
Total Paid Out
PKR {{ "%.0f"|format(total_paid_out) }}
Pending Refunds
PKR {{ "%.0f"|format(total_refunds_pending) }}
View
Pending Payouts
{{ pending_payouts|length }}
Process
Open Disputes
{{ disputes|length }}
Platform Revenue (Last {{ selected_days }} Day{% if selected_days > 1 %}s{% endif %})
Appointments by Status (Last {{ selected_days }} Day{% if selected_days > 1 %}s{% endif %})
{% if not status_has_data %}
No appointment status data in selected range.
{% endif %}
Payment flow log
{% if payment_flow %}
{% for a in payment_flow[:15] %} {% endfor %}
Appt Patient Doctor Amount Booked Approved Payment Paid at Completed Doctor credited
#{{ a.id }} {{ a.patient.user.name if a.patient and a.patient.user else '-' }} {{ a.doctor.user.name if a.doctor and a.doctor.user else '-' }} PKR {{ "%.0f"|format(a.charges) }} {{ a.created_at.strftime('%d %b %H:%M') if a.created_at else '-' }} {{ a.approved_at.strftime('%d %b %H:%M') if a.approved_at else '-' }} {{ a.payment_status }} {{ a.payment_approved_at.strftime('%d %b %H:%M') if a.payment_approved_at else (a.payment_submitted_at.strftime('%d %b %H:%M') if a.payment_submitted_at else '-') }} {{ a.completed_at.strftime('%d %b %H:%M') if a.completed_at else '-' }} {{ a.doctor_earning_credited_at.strftime('%d %b %H:%M') if a.doctor_earning_credited_at else 'Reserve' }}
{% else %}
No payment flow records yet.
{% endif %}
Reserve (held) – released after 24h review
Full payment held in reserve; after completion + 24h, 80% credits to doctor and 20% records as platform revenue.
{% if reserve_appointments %}
{% for a in reserve_appointments[:15] %} {% endfor %}
ApptDoctorPatientHeld amount (100%)Release after
#{{ a.id }} {{ a.doctor.user.name if a.doctor and a.doctor.user else '-' }} {{ a.patient.user.name if a.patient and a.patient.user else '-' }} PKR {{ "%.0f"|format(a.charges or 0) }} {% if a.completion_review_deadline %} {{ a.completion_review_deadline.strftime('%d %b %Y %H:%M') }} {% elif a.status == 'approved' %} After completion + 24h {% else %} - {% endif %}
{% else %}
No reserve (no appointments in 24h review window).
{% endif %}
Open disputes
{% if disputes %}
{% for a in disputes[:10] %} {% endfor %}
ApptPatientDoctorDispute reasonDateRecordings
#{{ a.id }} {{ a.patient.user.name if a.patient and a.patient.user else '-' }} {{ a.doctor.user.name if a.doctor and a.doctor.user else '-' }} {{ (a.dispute_reason or '-')[:80] }}{% if a.dispute_reason and a.dispute_reason|length > 80 %}...{% endif %} {{ a.updated_at.strftime('%d %b %Y %H:%M') if a.updated_at else '-' }} View
{% else %}
No open disputes.
{% endif %}
No-show cases
Mutual / patient no-show / doctor no-show
{% if no_show_cases %}
{% for a in no_show_cases[:15] %} {% endfor %}
TypeApptPatientDoctorRefundDoctor effectDate
{% if a.status == 'expired_mutual_noshow' %} Mutual no-show {% elif a.status == 'expired_patient_noshow' %} Patient no-show {% elif a.status == 'expired_provider_failure' %} Doctor no-show {% else %} {{ a.status }} {% endif %} #{{ a.id }} {{ a.patient.user.name if a.patient and a.patient.user else '-' }} {{ a.doctor.user.name if a.doctor and a.doctor.user else '-' }} {% if a.status in ['expired_mutual_noshow','expired_provider_failure'] %}PKR {{ "%.0f"|format(a.charges) }} (refund){% else %}-{% endif %} {% if a.status == 'expired_patient_noshow' %}80% to doctor{% elif a.status == 'expired_provider_failure' %}20% penalty{% else %}-{% endif %} {{ a.updated_at.strftime('%d %b %Y %H:%M') if a.updated_at else '-' }}
{% else %}
No no-show cases.
{% endif %}
Pending Refunds
{% if pending_refunds %} {% for r in pending_refunds[:10] %} {% endfor %}
AppointmentPatientReasonAmountDate
#{{ r.appointment_id }} {{ r.patient.user.name if r.patient and r.patient.user else '-' }} {% set reason_key = (r.reason or '')|lower %} {% if reason_key in ['mutual_no_show', 'mutual no show'] %} {{ (r.reason or 'n/a')|replace('_', ' ')|title }} {% else %} {{ (r.reason or 'n/a')|replace('_', ' ')|title }} {% endif %} PKR {{ "%.2f"|format(r.amount) }} {{ r.created_at.strftime('%d %b %Y') if r.created_at else '-' }} Process
{% else %}
No pending refunds.
{% endif %}
Pending Payout Requests
{% if pending_payouts %} {% for p in pending_payouts[:10] %} {% endfor %}
DoctorAmountRequested
{{ p.doctor.user.name if p.doctor and p.doctor.user else '-' }} PKR {{ "%.2f"|format(p.amount) }} {{ p.requested_at.strftime('%d %b %Y %H:%M') if p.requested_at else '-' }} Approve/Reject
{% else %}
No pending payout requests.
{% endif %}
{% endblock %}